package com.cc.controller;

import com.cc.entity.User;
import com.cc.service.UserSerivce;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @program:
 * @ClassName:
 * @description:
 * @author: zgc
 * @date:
 * @Version 1.0
 **/
@RestController
@RefreshScope
public class UserController {
    @Resource
    private UserSerivce userSerivce;

    @RequestMapping("/login")
    public User login(String username, String password) throws InterruptedException {

        User user = userSerivce.selectUserInfo(new User(username, password));
        System.out.println(user);
        if (user != null) {
            if (user.getPassword().equals(password)) {
                //Thread.sleep(1000);
                return user;
            }
        }
        return null;
    }
}
